/**
 */
package org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.ComponentActionStatement;
import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.ComponentBasedSoftwareDevelopmentPackage;
import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.ComponentLeadstoConstraint;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Component Leadsto Constraint</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl.ComponentLeadstoConstraintImpl#getLeftAction <em>Left Action</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl.ComponentLeadstoConstraintImpl#getRightAction <em>Right Action</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ComponentLeadstoConstraintImpl extends ComponentStatementImpl implements ComponentLeadstoConstraint
{
  /**
   * The cached value of the '{@link #getLeftAction() <em>Left Action</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLeftAction()
   * @generated
   * @ordered
   */
  protected ComponentActionStatement leftAction;

  /**
   * The cached value of the '{@link #getRightAction() <em>Right Action</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRightAction()
   * @generated
   * @ordered
   */
  protected ComponentActionStatement rightAction;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ComponentLeadstoConstraintImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ComponentBasedSoftwareDevelopmentPackage.Literals.COMPONENT_LEADSTO_CONSTRAINT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ComponentActionStatement getLeftAction()
  {
    return leftAction;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetLeftAction(ComponentActionStatement newLeftAction, NotificationChain msgs)
  {
    ComponentActionStatement oldLeftAction = leftAction;
    leftAction = newLeftAction;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__LEFT_ACTION, oldLeftAction, newLeftAction);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setLeftAction(ComponentActionStatement newLeftAction)
  {
    if (newLeftAction != leftAction)
    {
      NotificationChain msgs = null;
      if (leftAction != null)
        msgs = ((InternalEObject)leftAction).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__LEFT_ACTION, null, msgs);
      if (newLeftAction != null)
        msgs = ((InternalEObject)newLeftAction).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__LEFT_ACTION, null, msgs);
      msgs = basicSetLeftAction(newLeftAction, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__LEFT_ACTION, newLeftAction, newLeftAction));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ComponentActionStatement getRightAction()
  {
    return rightAction;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetRightAction(ComponentActionStatement newRightAction, NotificationChain msgs)
  {
    ComponentActionStatement oldRightAction = rightAction;
    rightAction = newRightAction;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__RIGHT_ACTION, oldRightAction, newRightAction);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setRightAction(ComponentActionStatement newRightAction)
  {
    if (newRightAction != rightAction)
    {
      NotificationChain msgs = null;
      if (rightAction != null)
        msgs = ((InternalEObject)rightAction).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__RIGHT_ACTION, null, msgs);
      if (newRightAction != null)
        msgs = ((InternalEObject)newRightAction).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__RIGHT_ACTION, null, msgs);
      msgs = basicSetRightAction(newRightAction, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__RIGHT_ACTION, newRightAction, newRightAction));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__LEFT_ACTION:
        return basicSetLeftAction(null, msgs);
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__RIGHT_ACTION:
        return basicSetRightAction(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__LEFT_ACTION:
        return getLeftAction();
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__RIGHT_ACTION:
        return getRightAction();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__LEFT_ACTION:
        setLeftAction((ComponentActionStatement)newValue);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__RIGHT_ACTION:
        setRightAction((ComponentActionStatement)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__LEFT_ACTION:
        setLeftAction((ComponentActionStatement)null);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__RIGHT_ACTION:
        setRightAction((ComponentActionStatement)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__LEFT_ACTION:
        return leftAction != null;
      case ComponentBasedSoftwareDevelopmentPackage.COMPONENT_LEADSTO_CONSTRAINT__RIGHT_ACTION:
        return rightAction != null;
    }
    return super.eIsSet(featureID);
  }

} //ComponentLeadstoConstraintImpl
